package cn.javass.dp.strategy.selfexample;

/**
 * Created by wanggen on 19/7/25.
 */
public class CashReturn  extends CashSuper  {

    private double moneyCondition = 0.0d;
    private double moneyReturn = 0.0d;

    public CashReturn(double moneyCondition,double moneyReturn)
    {
        this.moneyCondition = moneyCondition;
        this.moneyReturn = moneyReturn;
    }

    @Override
    public double acceptCash(double money) {
        double result = money;
        if (money >= moneyCondition)
            result=money- Math.floor(money / moneyCondition) * moneyReturn;
        System.out.println("CashReturn:"+result);
        return result;
    }
}
